function factorialize(num){
    if (num < 0){
        return -1;
    } else if(num === 0 || num === 1){
        return 1;
    } else {
        return (num * factorialize(num-1));
    }
}

// es6
function factorialize2(n,acc=1){
    if(n<=1) return acc;
    return factorialize2(n-1,n*acc);
}

console.log(factorialize(-5));
console.log(factorialize2(5));